<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Log;
use DB;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        DB::listen(function ($query) {
            $sql = $query->sql;
            $bindings = $query->bindings;
            $time = $query->time;
            $sql = str_replace("?", "%s", $sql);
            $msg = "time: $time, sql: " . vsprintf($sql, $bindings);
            Log::debug($msg);
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
    }
}
